]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
extension-tool: Show "version-name" field if set
authorFlorian Müllner <fmuellner@gnome.org>
Thu, 30 Nov 2023 13:18:36 +0000 (14:18 +0100)
committerFlorian Müllner <fmuellner@gnome.org>
Thu, 30 Nov 2023 22:23:58 +0000 (23:23 +0100)
Now that both the website and the Extension app support the custom
"version-name" field, we should expose it in the CLI tool as well.

As a more developer-oriented tool, keep showing the automatic
version along-side the new field when both are set.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3034>
(cherry picked from commit ca47e7f8e3dd4f4f7de9e4b7b7d16df8f155aeb3)

subprojects/extensions-tool/src/main.c

index 5bf2579b7fd4dd185d6625119f2011d75d7f82f8..327617415f90b98166aaae13697932bae912ede9 100644 (file)
@@ -229,8 +229,9 @@ void
 print_extension_info (GVariantDict  *info,
                       DisplayFormat  format)
 {
-  const char *uuid, *name, *desc, *path, *url, *author;
+  const char *uuid, *name, *desc, *path, *url, *author, *version_name;
   double state, version;
+  gboolean has_version, has_version_name;
 
   g_variant_dict_lookup (info, "uuid", "&s", &uuid);
   g_print ("%s\n", uuid);
@@ -253,7 +254,14 @@ print_extension_info (GVariantDict  *info,
   if (g_variant_dict_lookup (info, "original-author", "&s", &author))
     g_print ("  %s: %s\n", _("Original author"), author);
 
-  if (g_variant_dict_lookup (info, "version", "d", &version))
+  has_version = g_variant_dict_lookup (info, "version", "d", &version);
+  has_version_name = g_variant_dict_lookup (info, "version-name", "&s", &version_name);
+
+  if (has_version_name && has_version)
+    g_print ("  %s: %s (%.0f)\n", _("Version"), version_name, version);
+  else if (has_version_name)
+    g_print ("  %s: %s\n", _("Version"), version_name);
+  else if (has_version)
     g_print ("  %s: %.0f\n", _("Version"), version);
 
   g_variant_dict_lookup (info, "state", "d", &state);